package com.example.demo.service.Impl;
import com.example.demo.mapper.ResultProjectmapper;
import com.example.demo.pojo.Doc;
import com.example.demo.pojo.PageBean;
import com.example.demo.pojo.ResultProject;
import com.example.demo.service.LoginRegisterservice;
import com.example.demo.service.ResultProjectservice;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ResultProjectimpl implements ResultProjectservice {
    @Autowired
ResultProjectmapper resultProjectmapper;
    @Autowired
    LoginRegisterservice loginRegisterservice;

    public List<ResultProject> queryAll(){
        return  resultProjectmapper.queryAll();

    }
    public  List<String> queryOnlyTwo(){
        return resultProjectmapper.queryOnlyTwo();

    }
    public List< String> queryResult(String project){
        return resultProjectmapper.queryResult(project);
    }
    public  List<ResultProject> queryOne(String result){
        return  resultProjectmapper.queryOne(result);
   }
    public void insert(ResultProject resultProject){
        resultProjectmapper.insert(resultProject);
   }
    public  void deleteById(Integer rpId){
        resultProjectmapper.deleteById(rpId);
  }
    public  void update(ResultProject resultProject){
        resultProjectmapper.update(resultProject);
  }
     public  List<ResultProject> callQueryAll(){
       return resultProjectmapper.callQueryAll();
  }
    public PageBean page(Integer page, Integer pageSize){
        PageHelper.startPage(page,pageSize);
        List<ResultProject> docList=resultProjectmapper.queryAll();
        Page<ResultProject> p= (Page<ResultProject>) docList;
        PageBean pageBean =new PageBean(p.getTotal(),p.getResult());
        return  pageBean;
    }
    public  String selectpost(String username){
        return loginRegisterservice.selectpost(username);

    }
    public List<ResultProject>queryName(String result){
        return  resultProjectmapper.queryName(result);
    }

    @Override
    public List<String> test(String[] selectedData) {
        return resultProjectmapper.test(selectedData);
    }

    @Override
    public List<String> projects() {
        return resultProjectmapper.projects();
    }


}
